package com.tiancheng.trade.order.service;

import com.tiancheng.trade.order.bo.cmq.CreditOrderFundAuthFreezeBo;
import com.tiancheng.trade.order.enums.CreditOrderOperationTypeEnum;
import com.tiancheng.trade.order.model.CreditOrder;
import com.tiancheng.trade.order.model.CreditOrderOperation;

/**
 * 信用订单表操作流水Service接口
 *
 * @author likailun
 * @date 2024-09-16
 */
public interface CreditOrderOperationService {
    CreditOrderOperation create(String orderId, String creditType,String operationType, String gwOrderId, String remark);

    /**
     * 更新操作流水（支付）状态支付成功
     * @param orderId
     * @param alipayAuthNo
     * @param amount
     */
    void updatePaidOperation(String orderId,String alipayAuthNo,Integer amount);

    /**
     * 保存信用订单表操作流水(根据id新增或者修改)
     * @param creditOrderOperation
     */
    void save(CreditOrderOperation creditOrderOperation);

    /**
     * 根据订单ID和操作类型查询操作记录
     * @param orderId 订单id
     * @param operationType 操作类型
     * @return
     */
    CreditOrderOperation queryByOrderIdAndOperationType(String orderId,String operationType);

    /**
     * 根据RequestNo和操作类型查询操作记录
     * @param requestNo
     * @param operationType
     * @return
     */
    CreditOrderOperation getOperationModelByRequestNoType(String requestNo,String operationType);

    /**
     * 更新操作记录信息
     * @param creditOrder 授权订单
     * @param payNotifyBO 信用订单预授权冻结回调结果
     * @param type 操作类型
     * @param remark 操作描述
     */
    void updateOperation(CreditOrder creditOrder, CreditOrderFundAuthFreezeBo payNotifyBO, CreditOrderOperationTypeEnum type, String remark);
}
